# Maintainer: Bruno Pagani <archange@archlinux.org>

pkgname=adios2
pkgver=2.9.2
pkgrel=1
pkgdesc="The Adaptable Input/Output System version 2"
arch=(loong64 x86_64)
url="https://adios2.readthedocs.io/en/latest/"
license=(Apache)
depends=(blosc bzip2 glibc gcc-libs hdf5 libfabric libpng nlohmann-json
         openmpi pugixml pybind11 sz yaml-cpp zeromq zfp zlib)
# with mgard does not build currently, not time to investigate
makedepends=(cmake gcc-fortran gtest python python-mpi4py python-numpy)
source=(https://github.com/ornladios/ADIOS2/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('78309297c82a95ee38ed3224c98b93d330128c753a43893f63bbe969320e4979')

build() {
  cmake -B build -S ${pkgname^^}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_SKIP_RPATH=ON \
    -DADIOS2_USE_EXTERNAL_DEPENDENCIES=ON \
    -DADIOS2_HAVE_HDF5_VOL=OFF \
    -DADIOS2_BUILD_EXAMPLES=OFF #\
    #-DMGARD_INCLUDE_DIR=/usr/include/mgard
    #-DADIOS2_HAVE_HDF5_VOL needs hdf5-openmpi
  make VERBOSE=1 -C build
}

package() {
  CMAKE_PREFIX_PATH="$pkgdir"/usr/lib/cmake \
  make -C build DESTDIR="${pkgdir}" install
}
